<gm:page title="NEWS.com.au Feeds" authenticate="true" onload="init()">

  <script>
    var invisibleList1;
    var invisibleList2;
    var aggregateList;
    
    function init() {
      invisibleList1 = google.mashups.getObjectById("invisibleList1");
      invisibleList2 = google.mashups.getObjectById("invisibleList2")
      aggregateList = google.mashups.getObjectById("aggregateList");
    }
    
    function invisibleList1Handler() {
      copyList(invisibleList1);
    }
      
    function invisibleList2Handler() {
      copyList(invisibleList2);
    }
    
    function copyList(list) {
      for (var i=0; i<list.getData().size(); i++) {
        var entry = list.getData().entryAt(i);
        aggregateList.getData().addEntry(entry);
      }
    }
  </script>
  
  <gm:list id="invisibleList1" data="http://feeds.news.com.au/public/rss/2.0/news_top_stories_48.xml" style="display:none">
    <gm:handleEvent event="repaint" execute="invisibleList1Handler()" />
  </gm:list>
  
  <gm:list id="invisibleList2" data="http://feeds.news.com.au/public/rss/2.0/news_breaking_news_32.xml" style="display:none">
    <gm:handleEvent event="repaint" execute="invisibleList2Handler()" />
  </gm:list>
  
  <div style="background: red; width: 300px;">
  <gm:list id="aggregateList" size="10" data="${user}/aggregatedFeeds" />
  </div>
  <div style="float: left; width: 300px;">
        <gm:item id="item" template="template">
    <gm:handleEvent src="aggregateList" />
  </gm:item>
  </div>

  
  <gm:template id="template">
   <div repeat="true">
      <b><gm:text ref="atom:title"/></b>
      <gm:text ref="atom:id"/>
      <hr size="1"/>
      <gm:date ref="gd:when/@startTime"/>
      <gm:html ref="atom:content"/>
    </div>
  </gm:template>
</gm:page>